//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<XChunk.h>
///	@path	~/src/scene/xworld/
///	@date	2007/12/19
///	@desc	Lowest spacing structure, but still holds slices for height.

#pragma once

#include "xeres.h"

#include <deque>
#include <map>

#include "scene/ILive.h"
#include "scene/ScenePresentation.h"
#include "scene/xworld/XWorld.h"

namespace xeres {

	/*!
		\class	XChunk
		\brief	Holding smallest unit of space structure.
	*/
	class XChunk
	{
	public:

		/// \ctor
		XChunk( void );

		/// \dtor
		virtual ~XChunk( void );

		DECL_IOBJECT_CLASS( XChunk , IObject );

	//@ interface

		/*!
			\brief		Update space elements.
		*/
		virtual void Tick( const Frame& frame );

		/*!
			\brief		Update scene presentations.
		*/
		virtual void Present( ScenePresentation& sp );

		/*!
			\brief		Get axis aligned bounding box.
		*/
		virtual const Box<float> GetBound( void );

	private:


	//@ data

		// owning space
		RefWeak<XSpace>				m_space;

		// lives living in chunks that don't move to other chunk
		std::vector< Ref<ILive> >		m_staticLives;

		// entities in chunk, may move to other chunk
		std::map< uint,Ref<IEntity> >	m_chunkEntities;
	};

} // namespace xeres
